     .data
saida:
     .space 28
num:
     .space 28
aux:
     .space 32

     .text

addi $10, $0, 0

addi $9, $0, 5
sw $9, num($10)
addi $10, $10, 4

addi $9, $0, 9
sw $9, num($10)
addi $10, $10, 4

addi $9, $0, 4
sw $9, num($10)
addi $10, $10, 4

addi $9, $0, 28
sw $9, num($10)
addi $10, $10, 4

addi $9, $0, 2
sw $9, num($10)
addi $10, $10, 4

addi $9, $0, 12
sw $9, num($10)
addi $10, $10, 4

addi $9, $0, 1
sw $9, num($10)
addi $10, $10, 4

inicio:

addi $5, $0, 0

contar:

     lw $6, num($5)
     sll $6, $6, 2
     lw $9, aux($6)
     addi $6, $6, 1
     sw $9, aux($6)
     addi $5, $5, 4
     addi $9, $0, 28
     sub $9, $9, $5
     bltz $9, contar

addi $5, $0, 0

acumular:

     lw $8, aux($5)
     addi $5, $5, 4
     lw $9, aux($5)
     add $9, $9, $8
     sw $9, aux($5)
     addi $9, $0, 28
     sub $9, $9, $5
     bltz $9, contar

addi $5, $5, 28

computar_saida:
     addi $10, $0, 4
     sub $5, $5, $10
     lw $7, num($5)
     sll $7, $7, 2
     lw $8, aux($7)
     lw $9, aux($7)
     addi $10, $0, 1
     sub $9, $9, $10
     sw $9, aux($7)
     sll $8, $8, 2
     addi $10, $10, 4
     sub  $8, $8, $10
     srl $7, $7, 2
     sw $7, saida($8)
     bne $5, $0, computar_saida
